package subtractProductAndSum;

public class Solution {
    public int subtractProductAndSum(int n) {
        return getMuilt(n)-getSum(n);
    }
    private int getSum(int n){
        int sum=0;
        while(n>0){
            sum+=n%10;
            n/=10;
        }
        return sum;
    }
    private int getMuilt(int n){
        int num=1;
        while(n>0){
            num*=n%10;
            n/=10;
        }
        return num;
    }
}
